package com.example.web.mapper;

import com.example.web.model.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Create by keboom on 2020/7/7
 */
@Mapper
public interface CartMapper {

    @Insert("insert into shoppingcart(userName,productId,expired) values(#{userName},#{productId},#{expired})")
    int insertCart(ShoppingCart cart);

    @Select("select * from shoppingcart where userName=#{username}")
    List<ShoppingCart> selectCart(String username);

    @Delete("delete from shoppingcart where userName=#{username}")
    int deleteByUsername(String username);
}
